package com.likl.controller;

import com.likl.domain.SMSCode;
import com.likl.service.SMSCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:springboot_study
 * Description:
 *
 * @Create: 2024/7/12 14:35
 * @author: likl
 * @e-mail: likl1102@foxmail.com
 * @QQ: 2514927731
 */
@RestController
@RequestMapping("/sms")
public class SMSCodeController {

    @Autowired
    private SMSCodeService smsCodeService;

    @GetMapping("{phone}")
    public String getCode(@PathVariable String phone) {
        return smsCodeService.sendCodeToSMS(phone);
    }

    @PostMapping
    public boolean checkCode(@RequestBody SMSCode smsCode) {
        return smsCodeService.checkCode(smsCode);
    }
}
